@**
 * Copyright (c) 2013-2017, 2021 Kaj Magnus Lindberg
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *@

@(tpi: debiki.SiteTpi, useGoogleAnalytics: Boolean = true, noindex: Boolean = false)(content: Html)

<!DOCTYPE html>
<html class="@tpi.debikiHtmlTagClasses">
<head>
@tpi.jsonDataMustBeFirst()

@if(noindex) {
<meta name="robots" content="noindex">
}
@tpi.debikiMeta
@if(tpi.anyEmbeddingUrl.nonEmpty) {
<base href="@{tpi.anyEmbeddingUrl.get}" target="_parent">
}
@Html(tpi.anySafeMetaTags)
@tpi.talkyardStyles
@tpi.anySiteCustomStylesBundle("styles.css")
@Html(tpi.siteSettings.headStylesHtml)

@tpi.parseJsonUpdDocClassesScript()

@if(useGoogleAnalytics) {
@Html(tpi.anyGoogleUniversalAnalyticsScript)
}
</head>
<body>
<!-- wrapper.scala.html -->
@Html(tpi.siteSettings.startOfBodyHtml)@* [cust_html_not_db_cached] *@
<div id="esPageColumn" tabindex="-1">
<div id="esPageScrollable">
<div id="thePageTop"></div>
<div class="esPageHeader">
@* Auto collapse nav menu items, if narrow screen?  https://github.com/lukejacksonn/GreedyNav  *@
@* Move to Typescript? So can hide, if not logged in. [7WKBAY02] *@
@Html(tpi.siteSettings.headerHtml)
</div>

@content

@if(!tpi.anyCurrentPageRole.exists(_.isChat)) {
  @* Move to Typescript? So can hide, if not logged in. [7WKBAY02] *@
  @Html(tpi.siteSettings.footerHtml)
}

<div id="thePageBottom"></div>
</div>
</div>
<div id="theSidebarPageOverlay"></div>
<div id="esWatchbarColumn"></div>
<div id="esThisbarColumn"><div id="dw-any-sidebar"></div></div>

@tpi.talkyardScriptBundles()
@Html(tpi.siteSettings.headScriptsHtml)
@tpi.anySiteCustomScriptBundle()
@Html(tpi.siteSettings.endOfBodyHtml)
</body>
</html>
